package top.frsf.plants;

import top.frsf.GamePanel;
import top.frsf.utils.GameState;

import java.awt.*;
import java.util.ArrayList;

/**
 * @BelongsProject: MiniPZ
 * @BelongsPackage: top.frsf.plants
 * @Author: FRSF
 * @CreateTime: 2022-09-07  12:54
 * @Description: 植物元素启动器
 * @Version: 1.0
 */
public class PlaStart {


    // 植物集合
    public final ArrayList<PlantsObject> plantList = new ArrayList<>();

    // 植物移除集合
    public final ArrayList<PlantsObject> delPlaList = new ArrayList<>();


    public void paintPla(Graphics g) {
        // 游戏开始
        if (GamePanel.stage == GameState.RUNNING) {
            plantList.removeAll(delPlaList);
            if (GamePanel.fps % 500 == 1)
                delPlaList.clear();

            for (PlantsObject plant : plantList) {
                plant.paintSelf(g);
            }
        }
    }
}
